<?php
/*
 *      [Discuz! X] (C)2012-2012 bbs.heirui.cn.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: yy_recode.inc.php 2518 2012-07-1 19:11:52Z yanyuxiaoyao $
 */
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
	exit('Access Denied');
}

if(submitcheck('delete')&&!empty($_GET['ids'])){
	DB::query("DELETE FROM ".DB::table('yy_pay_log')." WHERE pl_id in(".dimplode($_GET['ids']).")");
	cpmsg(plang('var20'), 'action=plugins&operation=config&do='.$pluginid.'&identifier=yy_pay&pmod=yy_record', 'succeed');
}
$search=daddslashes(trim($_GET['search']));
$perpage = 20;
$start = ($page-1)*$perpage;
if($search)
{
	$mpurl=ADMINSCRIPT.'?action=plugins&operation=config&do='.$pluginid.'&identifier=yy_pay&pmod=yy_record&search='.$search;
	$sql="SELECT * FROM ".DB::table('yy_pay_log')." WHERE pl_uid='$search' OR pl_uname='$search' ORDER BY pl_id DESC LIMIT $start,$perpage";
	$countsql="SELECT pl_id FROM ".DB::table('yy_pay_log')." WHERE pl_uid='$search' OR pl_uname='$search'";
}
else
{
	$mpurl=ADMINSCRIPT.'?action=plugins&operation=config&do='.$pluginid.'&identifier=yy_pay&pmod=yy_record';
	$sql="SELECT * FROM ".DB::table('yy_pay_log')." ORDER BY pl_id DESC LIMIT $start,$perpage";
	$countsql="SELECT pl_id FROM ".DB::table('yy_pay_log');
}
showformheader('plugins&operation=config&do='.$pluginid.'&identifier=yy_pay&pmod=yy_record');
showtableheader(plang('var21'), '');
showsubtitle(array('',plang('var16'), plang('var17'),plang('var18'),plang('var19')));
$query=DB::query($sql);
$count = DB::num_rows(DB::query($countsql));
if($count){
	while($r = DB::fetch($query)) {
		showtablerow('', array('class="td25"', 'class=""', 'class="td28"', 'class="td28"', 'class="td28"'), array(
						"<input type=\"checkbox\" class=\"checkbox\" name=\"ids[]\" value=\"$r[pl_id]\">",
						'<a href="home.php?mod=space&uid='.$r['pl_uid'].'" target="_blank">'.$r['pl_uname'].'</a>',
						$r['pl_pay'].$_G['setting']['extcredits'][$r['pl_extcredit']]['title'],
						'<a href="forum.php?mod=redirect&goto=findpost&pid='.$r['pl_pid'].'" target="_blank">'.$r['pl_pid'].'</a> '.$r['pl_cid'],
						$r['pl_time'])
					);
	}
	$multipage = multi($count, $perpage, $page, $mpurl);
	showsubmit('', '', '', '<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'ids\')" /><label for="chkall">'.plang('var23').'</label>&nbsp;&nbsp;
					<input type="submit" class="btn" name="delete" value="'.plang('var24').'" onclick="if(confirm(\''.plang('var22').'\')){this.form.submit();}"/>', $multipage);
}
showtablefooter();
showformfooter();

function plang($str) {
	return lang('plugin/yy_pay', $str);
}
?>